06b56cf4497ac294d18c18684749f11ba2497b8e,java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithWhileSurrounder.java,JavaWithWhileSurrounder,surroundStatements,#Project#Editor#PsiElement#PsiElement[]#,33

Before Change



    whileStatement = (PsiWhileStatement)container.addAfter(whileStatement, statements[statements.length - 1]);

    PsiCodeBlock bodyBlock = ((PsiBlockStatement)whileStatement.getBody()).getCodeBlock();
    bodyBlock.addRange(statements[0], statements[statements.length - 1]);
    container.deleteChildRange(statements[0], statements[statements.length - 1]);

    return whileStatement.getCondition().getTextRange();
  }
}

After Change


    whileStatement = (PsiWhileStatement)container.addAfter(whileStatement, statements[statements.length - 1]);

    PsiStatement body = whileStatement.getBody();
    if (!(body instanceof PsiBlockStatement)) {
      return null;
    }
    PsiCodeBlock bodyBlock = ((PsiBlockStatement)body).getCodeBlock();
    SurroundWithUtil.indentCommentIfNecessary(bodyBlock, statements, factory);
    bodyBlock.addRange(statements[0], statements[statements.length - 1]);
    container.deleteChildRange(statements[0], statements[statements.length - 1]);

    PsiExpression condition = whileStatement.getCondition();
    return condition == null ? null : condition.getTextRange();
  }
}